Installation Instructions

Download and install miniconda: https://conda.io/miniconda.html

Make sure you are using the conda-forge channel:

$ conda config --add channels conda-forge
$ conda update --yes conda python

Install gsshapy:

$ conda create -n gssha python=2
$ source activate gssha
(gssha)$ conda install --yes gsshapy jupyter

Install GSSHA: http://www.gsshawiki.com/GSSHA_Download

For Windows, add GSSHA executable to Path:
    1. Go to: "Control Panel\System and Security\System"
    2. Click "Advanced system settings"
    3. Click "Environmental variables ..."
    4. Edit the "Path" variable under "User variables" and add the path to the directory containing GSSHA (i.e. C:\Program Files\U.S. Army\gssha70)

Make sure GSSHA is on the PATH:


In [5]:
!gssha70


Parallel version of GSSHA (7.0 ) with SCE (OpenMP), 8 total threads.

Usage: gssha [-option] [inputfile]

 where -option is one of:
      -c = SCE calibration mode (input file is the calibration control file)
      -m = Monte Carlo calibration mode (input file is the calibration control file)
      -b = batch mode (input file is the batch control file)
      -s = sensitivity mode (input file is the sensitivity control file)
      -v = display version information (no project will be run)
  The c, m, b, and v commands are optional and if not present the input file is
 treated as the project file

  For the -b option, the command line should be:
      gssha -b[num_batch] gssha_inputfile

  For the -c option, the command line should be:
      gssha -c sce_inputfile

  For the -m option, the command line should be:
      gssha -m[num_batch] mc_inputfile

  For the -s option, the command line should be:
      gssha -s sen_inputfile

  For the -t option (and -tv), the command line should be:
      gssha -t[v]

  where [num_batch] is the number of batch runs to make, sce_inputfile is the SCE input file, mc_intputfile is
  the Monte Carlo input file, and sen_inputfile is the sensitivity input file.


In [1]:
import os
from datetime import datetime, timedelta

from gsshapy.modeling import GSSHAFramework

Setup environment:


In [2]:
# assuming notebook is run from examples folder
base_dir = os.getcwd()
gssha_model_name = 'philippines_example'
gssha_model_directory = os.path.join(base_dir, gssha_model_name)

Run the model:


In [3]:
gr = GSSHAFramework("gssha70",
                    gssha_model_directory,
                    "{0}.prj".format(gssha_model_name),
                    gssha_simulation_start=datetime(2017, 5 ,9),
                    gssha_simulation_duration=timedelta(seconds=2*60))

# http://www.gsshawiki.com/Model_Construction:Defining_a_uniform_precipitation_event
rain_intensity = 24  # mm/hr 
rain_duration = timedelta(seconds=1*60)  # 2 minutes
gr.event_manager.add_uniform_precip_event(rain_intensity,
                                          rain_duration)

gssha_event_directory = gr.run()

The gssha_event_directory is where the simulation output is stored.


In [4]:
gssha_event_directory


Out[4]:
u'C:\\Users\\rdchlads\\scripts\\gsshapy\\notebooks\\philippines_example\\run_201705090000to201705090002_2'

In [ ]: